/*
 * Alberto Ruiz-Larrea Guillén...11383
 * Erdi Dogruel..................14955
 * Marcos Pérez Martín...........10324
 */

package com.example.androball_manager;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import com.example.database.OpenDB;
import com.example.database.UpdateTeams;

public class WeekMatchesActivity extends Activity {

	OpenDB db;
	String selected_team;
	public static String result_string = "";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_week_matches);

		// Shows the match simulation
		Intent i = getIntent();
		selected_team = i.getStringExtra("GAME");
		db = new OpenDB(this.getApplicationContext());
		TextView text = (TextView) findViewById(R.id.owngame);
		text.setMovementMethod(new ScrollingMovementMethod());

		UpdateTeams up = new UpdateTeams(db, 1, selected_team, text);
		up.execute();

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.week_matches, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onBackPressed() {
		super.onBackPressed();
		this.finish();
	}
}
